/*
*Copyright 2021-2023 NERCIS
*
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/

package cn.ac.nercis.pes.community.model.vo.knowledge;

import cn.ac.nercis.pes.common.constant.evaluation.EvaluationConclusion;
import cn.ac.nercis.pes.common.constant.evaluation.EvaluationResult;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import org.apache.commons.lang3.StringUtils;

/**
 * 现场测评信息（知识库）修改视图模型
 * @author zpy
 * @version 1.0.0
 */
public class KmEvaluationRecordVO {
    private final SimpleStringProperty id = new SimpleStringProperty();
    private final SimpleStringProperty unitTargetId = new SimpleStringProperty();
    private final SimpleStringProperty unitTargetName = new SimpleStringProperty();
    private final SimpleObjectProperty<EvaluationConclusion> conclusion = new SimpleObjectProperty<>();
    private final SimpleObjectProperty<EvaluationResult> dResult = new SimpleObjectProperty<>();
    private final SimpleObjectProperty<EvaluationResult> aResult = new SimpleObjectProperty<>();
    private final SimpleObjectProperty<EvaluationResult> kResult = new SimpleObjectProperty<>();
    private final SimpleStringProperty content = new SimpleStringProperty();
    private boolean change = false;

    public boolean isChange(){
        return change;
    }

    public void resetChange(){
        change = false;
    }


    public String getId() {
        return id.get();
    }

    public SimpleStringProperty idProperty() {
        return id;
    }

    public void setId(String id) {
        this.id.set(id);
    }
    public String getUnitTargetId() {
        return unitTargetId.get();
    }

    public SimpleStringProperty unitTargetIdProperty() {
        return unitTargetId;
    }

    public void setUnitTargetId(String unitTargetId) {
        if(!StringUtils.equals(getUnitTargetId(),unitTargetId)){
            change = true;
        }
        this.unitTargetId.set(unitTargetId);
    }

    public String getUnitTargetName() {
        return unitTargetName.get();
    }

    public SimpleStringProperty unitTargetNameProperty() {
        return unitTargetName;
    }

    public void setUnitTargetName(String unitTargetName) {
        if(!StringUtils.equals(getUnitTargetName(),unitTargetName)){
            change = true;
        }
        this.unitTargetName.set(unitTargetName);
    }

    public EvaluationConclusion getConclusion() {
        return conclusion.get();
    }

    public SimpleObjectProperty<EvaluationConclusion> conclusionProperty() {
        return conclusion;
    }

    public void setConclusion(EvaluationConclusion conclusion) {
        if(getConclusion() != conclusion){
            change = true;
        }
        this.conclusion.set(conclusion);
    }

    public EvaluationResult getdResult() {
        return dResult.get();
    }

    public SimpleObjectProperty<EvaluationResult> dResultProperty() {
        return dResult;
    }

    public void setdResult(EvaluationResult dResult) {
        if(getdResult() != dResult){
            change = true;
        }
        this.dResult.set(dResult);
    }

    public EvaluationResult getaResult() {
        return aResult.get();
    }

    public SimpleObjectProperty<EvaluationResult> aResultProperty() {
        return aResult;
    }

    public void setaResult(EvaluationResult aResult) {
        if(getaResult() != aResult){
            change = true;
        }
        this.aResult.set(aResult);
    }

    public EvaluationResult getkResult() {
        return kResult.get();
    }

    public SimpleObjectProperty<EvaluationResult> kResultProperty() {
        return kResult;
    }

    public void setkResult(EvaluationResult kResult) {
        if(getkResult() != kResult){
            change = true;
        }
        this.kResult.set(kResult);
    }

    public String getContent() {
        return content.get();
    }

    public SimpleStringProperty contentProperty() {
        return content;
    }

    public void setContent(String content) {
        if(!StringUtils.equals(getContent(),content)){
            change = true;
        }
        this.content.set(content);
    }

}